package site.timers.chat.util.netty;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.string.StringDecoder;
import io.netty.handler.codec.string.StringEncoder;

/**
 * @Classname GroupChatClientChannelInitializer
 * @Description TODO
 * @Version 1.0.0
 * @Date 2025/8/12 14:48
 * @Author twl
 */
public class GroupChatClientChannelInitializer  extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();
        //解码器
        pipeline.addLast("decoder", new StringDecoder());
        //编码器
        pipeline.addLast("encoder", new StringEncoder());
        //自定义handler
        pipeline.addLast("clientHandler", new GroupChatClientHandler());
    }
}
